import { createApp } from "vue";
import App from "@/App.vue";

// --- UI 框架 ---
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";
import zhCn from "element-plus/es/locale/lang/zh-cn"; // 中文语言包
import * as ElementPlusIconsVue from "@element-plus/icons-vue";

// --- 状态 & 路由 ---
import router from "@/router";
import pinia from "@/store";

const app = createApp(App);

// 使用插件（推荐顺序：状态 → 路由 → UI）
app.use(pinia);
app.use(router);
app.use(ElementPlus, {
  locale: zhCn,
  size: "default",
});

// 注册所有 Element Plus 图标为全局组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component);
}

app.mount("#app");
